package com.jianganming.flyweight;

//享元模式（缓存使用）
public class Test {
    public static void main(String[] args) {
        TrainTicketPool pool = new TrainTicketPool();
        TrainTicket trainTicket = pool.queryTicket("北京", "上海");
        System.out.println(trainTicket);
        TrainTicket trainTicket2 = pool.queryTicket("北京", "南昌");
        System.out.println(trainTicket2);
        TrainTicket trainTicket3 = pool.queryTicket("北京", "南昌西");
        System.out.println(trainTicket3);
        TrainTicket trainTicket4 = pool.queryTicket("北京", "南昌西");
        System.out.println(trainTicket4);
        System.out.println("=============火车列表=================");
        pool.showAll();
    }
}
